﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using BusinessLayer.Tables;

public partial class _Default : Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Db_Depo db = new Db_Depo();
            db.CreateTable();

            Db_FiyatTanim fyt = new Db_FiyatTanim();
            fyt.CreateTable();

            Db_Users usr = new Db_Users();
            usr.CreateTable();
            usr.UserKod = "admin";
            usr.UserAdi = "Yönetici";
            usr.UserPwd = "admin";
            usr.UserSystemIn = 0;
            usr.UserYetkili = true;
            usr.Save();

            Db_Musteri mus = new Db_Musteri();
            mus.CreateTable();

            Db_Poslar pos = new Db_Poslar();
            pos.CreateTable();

            Db_Special1 s1 = new Db_Special1();
            s1.CreateTable();

            Db_Special2 s2 = new Db_Special2();
            s2.CreateTable();

            Db_Special3 s3 = new Db_Special3();
            s3.CreateTable();

            Db_Special4 s4 = new Db_Special4();
            s4.CreateTable();

            Db_Special5 s5 = new Db_Special5();
            s5.CreateTable();

            Db_Special6 s6 = new Db_Special6();
            s6.CreateTable();

            Db_Special7 s7 = new Db_Special7();
            s7.CreateTable();

            Db_Special8 s8 = new Db_Special8();
            s8.CreateTable();

            Db_Special9 s9 = new Db_Special9();
            s9.CreateTable();

            Db_Special10 s10 = new Db_Special10();
            s10.CreateTable();

            PromoHeader proHeader = new PromoHeader();
            proHeader.CreateTable();

            PromoDetails proDetails = new PromoDetails();
            proDetails.CreateTable();

            Db_Firma firma = new Db_Firma();
            firma.CreateTable();

            Db_Donem donem = new Db_Donem();
            donem.CreateTable();

            Db_Birim birim = new Db_Birim();
            birim.CreateTable();

            Db_Fiyat fiyat = new Db_Fiyat();
            fiyat.CreateTable();

            Db_Stok stok = new Db_Stok();
            stok.CreateTable();

            Db_Barkot barkot = new Db_Barkot();
            barkot.CreateTable();

            Db_Stok_Depo stokDepo = new Db_Stok_Depo();
            stokDepo.CreateTable();

            Db_DovizTanim doviz = new Db_DovizTanim();
            doviz.CreateTable();

            Db_Vergi vergi = new Db_Vergi();
            vergi.CreateTable();

            Db_Reyon reyon = new Db_Reyon();
            reyon.CreateTable();

            Db_PosUpdate posupdate = new Db_PosUpdate();
            posupdate.CreateTable();
        }


        StartCrm();
    }

    private void StartCrm()
    {
        string strScript = "javascript:";
        strScript += "window.close(); window.open('CrmDefault.aspx ";
        strScript += "','_blank',";
        strScript += "'width=1000"; // Height
        strScript += ",height=650"; // Width
        strScript += ",scrollbars=1"; // Scrollbar
        strScript += "');";
        Page.ClientScript.RegisterStartupScript(typeof(Page), "load", strScript, true);
    }

}
